import request from '@/utils/request'

export const getList = params => {
  return request({
    url: '/SeriesRAPI/System/GetList',
    method: 'get',
    params: params
  })
}

export const getTermList = params => {
  return request({
    url: '/SeriesRAPI/System/GetTermListAsync',
    method: 'get',
    params: params
  })
}

export const save = data => {
  return request({
    url: '/SeriesRAPI/System/Add',
    method: 'post',
    data
  })
}
export const save_New = data => {
  return request({
    url: '/SeriesRAPI/Master/SubmitMaster',
    method: 'post',
    data
  })
}

export const saveTerm = data => {
  return request({
    url: '/SeriesRAPI/System/AddTerm',
    method: 'post',
    data
  })
}

// export const getById = id => {
//   return request({
//     url: `/SeriesRAPI/System/${id}`,
//     method: 'get',
//   })
// }

export const getById = params => {
  return request({
    url: `/SeriesRAPI/Master/GetDropdowns`,
    method: 'get',
    params: params
  })
}

export const getById_New = code => {
  return request({
    url: `/SeriesRAPI/Master/GetDropdowns`,
    method: 'get',
    params: { type: "104", code: code }
  })
}

// 上传图片
export const updateImg = data => {
  return request({
    url: '/SeriesRAPI/Master/UpdateHWSecurityCardImg',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data;charset=UTF-8'
    },
    data
  })
}

export const getTermById = id => {
  return request({
    url: `/SeriesRAPI/System/Term/${id}`,
    method: 'get',
  })
}

export const remove = data => {
  return request({
    url: `/SeriesRAPI/System/Remove`,
    method: 'post',
    data
  })
}

export const removeTerm = data => {
  return request({
    url: `/SeriesRAPI/System/TermRemove`,
    method: 'post',
    data
  })
}

export const enable = (data, enable) => {
  return request({
    url: `/SeriesRAPI/System/${enable}`,
    method: 'post',
    data
  })
}

export const enableTerm = (data, enable) => {
  return request({
    url: `/SeriesRAPI/System/Term/${enable}`,
    method: 'post',
    data
  })
}

export const getWasteTypeList = () => {
  return request({
    url: `/SeriesRAPI/System/WasteTypeList`,
    method: 'get',
  })
}

export const getWasteCodeList = id => {
  return request({
    url: `/SeriesRAPI/System/WasteCode/${id}`,
    method: 'get',
  })
}

export const getSourceProcessList = () => {
  return request({
    url: `/SeriesRAPI/System/SourceProcessList`,
    method: 'get',
  })
}

export const addWasteInformation = data => {
  return request({
    url: `/SeriesRAPI/System/AddWasteInformation`,
    method: 'post',
    data
  })
}

export const getWasteInformationList = params => {
  return request({
    url: '/SeriesRAPI/System/WasteInformationList',
    method: 'get',
    params: params
  })
}

export const GetWasteInformationListForProductAsync = () => {
  return request({
    url: `/SeriesRAPI/System/WasteInformationListForProduct`,
    method: 'get',
  })
}

export const getWasteTermList = () => {
  return request({
    url: '/SeriesRAPI/System/TermList',
    method: 'get',
  })
}

// 获取禁忌与应急措施列表
// export const getSafetyPrecautionsList = () => {
//   return request({
//     url: '/SeriesRAPI/HazardousWaste/GetHWSafetyprecautionsList',
//     method: 'get',
//   })
// }
export const getSafetyPrecautionsList = params => {
  return request({
    url: '/SeriesRAPI/HazardousWaste/GetHWSafetyprecautionsList',
    method: 'get',
    params: params
  })
}
// 删除禁忌与应急措施
export const removeSafetyPrecautions = id => {
  return request({
    url: `/SeriesRAPI/HazardousWaste/DelSafetyprecautionsLists?ids=${id}`,
    method: 'post',
  })
}
// 启用禁用禁忌与应急措施
export const enableSafetyPrecautions = data => {
  return request({
    url: `/SeriesRAPI/HazardousWaste/BatchUpdateSafetyprecautionsStatus`,
    method: 'post',
    data
  })
}

// 提交禁用禁忌与应急措施
export const saveSafetyPrecautions = data => {
  return request({
    url: '/SeriesRAPI/HazardousWaste/SubmitSafetyprecautions',
    method: 'post',
    data
  })
}
// 获取禁用禁忌与应急措施
export const getSafetyPrecautionsById = id => {
  return request({
    url: `/SeriesRAPI/HazardousWaste/GetHWSafetyprecautions?id=${id}`,
    method: 'get',
  })
}

// 获取禁忌与应急措施列表 不分页
export const GetAllHWSafetyprecautionsList = params => {
  return request({
    url: '/SeriesRAPI/HazardousWaste/GetAllHWSafetyprecautionsList',
    method: 'get',
    params: params
  })
}

export const getWasteInformationById = id => {
  return request({
    url: `/SeriesRAPI/System/WasteInformation/${id}`,
    method: 'get',
  })
}

export const enableWasteInformation = (data, enable) => {
  return request({
    url: `/SeriesRAPI/System/WasteInformation/${enable}`,
    method: 'post',
    data
  })
}

// 根据Type获取字典表List 不分页
export const getDictionaryListByType = types => {
  return request({
    url: `/SeriesRAPI/Master/DropdownList?type=${types}`,
    method: 'get',
  })
}

// 根据组织类型获取组织List 不分页  (组织类型：10:接受端(默认)  20:运输端  30:产废端  40:处置端)
export const getUnitInfoByType = params => {
  return request({
    url: '/JwtAPI/Company/GetAllCompanyList',
    method: 'get',
    params: params
  })
}

// 通过ID获取组织单位信息
export const getUnitInfoById = id => {
  return request({
    url: `/JwtAPI/Company/${id}`,
    method: 'get',
  })
}
